/* RGB Flashing Random Colors
 
 This example shows how to generate a random number to display on RGB LED using the analogWrite() function.
 
 The circuit:
 * V+ for RGB LED attached to digital pin 8.
 * Green inside RGB LED attached to digital pin 9.
 * Blue inside RGB LED attached to digital pin 10.
 * Red inside RGB LED attached to digital pin 11.
*/

const int LedV = 8;          // V+ for RGB LED
const int LedRed = 9;        // Red Color of RGB
const int LedGrn = 10;       // Green Color of RGB
const int LedBlu = 11;       // Blue Color od RGB
int LedRedValue, LedBluValue, LedGrnValue; // Temp Variables to store random numbers we generate.

void setup()  { 
  pinMode(LedRed, OUTPUT);   // sets the pins as outputs
  pinMode(LedGrn, OUTPUT);   
  pinMode(LedBlu, OUTPUT); 
  pinMode(LedV, OUTPUT); 
    // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);   
} 

void loop()  { 
  digitalWrite(LedV, HIGH);    // Set High for V+ on LED, Aprox 30ma 
    digitalWrite(LedRed, LOW);
    digitalWrite(LedBlu, HIGH);
  digitalWrite(LedGrn, HIGH);
  delay(5000);
  
     digitalWrite(LedRed, HIGH);
    digitalWrite(LedBlu, LOW);
  digitalWrite(LedGrn, HIGH);
  delay(5000);
  
    digitalWrite(LedRed, HIGH);
    digitalWrite(LedBlu, HIGH);
  digitalWrite(LedGrn, LOW);
  delay(5000);
  
    analogWrite(LedRed, 1); //yellow
    analogWrite(LedBlu, 255);
  analogWrite(LedGrn, 1);
   delay(5000);
     
    analogWrite(LedRed, 1);//orange
    analogWrite(LedBlu, 255);
  analogWrite(LedGrn, 102);
   delay(5000);
     
    analogWrite(LedRed, 1);// purple
    analogWrite(LedBlu, 1);
  analogWrite(LedGrn, 255);
   delay(5000);
     
    analogWrite(LedRed, 255); //aqua
    analogWrite(LedBlu, 1);
  analogWrite(LedGrn, 1);
   delay(5000);
   
  int LedRedValue = random(1,255);
  int LedBluValue = random(1,255);
  int LedGrnValue = random(1 ,255);
  analogWrite(LedRed, LedRedValue);
    analogWrite(LedBlu, LedBluValue);
  analogWrite(LedGrn, LedGrnValue);
  //digitalWrite(LedRed, HIGH);
//  digitalWrite(LedBlu, HIGH);
//  digitalWrite(LedGrn, HIGH);
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);
}

